package stream;

import java.util.Collections;
import java.util.Comparator;
import java.util.LinkedList;
import java.util.List;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import java.util.stream.Stream.Builder;

public class test {
    private static String[] s = {"大名","小名","大海","天海"};
    public static void main(String[] args) {
        // 创建 集合、数组、Stream.of、Stream.Builder、
        // 集合创建
        LinkedList<String> linkedList = new LinkedList<String>();
        Stream<String> linkeListStream = linkedList.stream();
        Stream<String> linkedListParallelStream = linkedList.parallelStream();
        // 通用API创建
        Stream<String> ofStream = Stream.of(s);
        // 构造器创建
        Builder<String> streamBuilder = Stream.builder();
        streamBuilder.accept("1");
        streamBuilder.accept("1");
        streamBuilder.accept("8");
        streamBuilder.accept("5");
        Stream<String> builderStream = streamBuilder.build();
        
        // 通过元素生成器创建
        Stream<String> streamGenerate = Stream.generate(() -> "a").limit(10);

        // 中间操作 去重，排序，过滤，截取，跳过
        
        // 终端操作 匹配与查找

        // 终端操作 规约
        
        // 终端操作 收集
        String list = builderStream.collect(Collectors.joining(",","(",")"));
        System.out.println(list);
    }

}
